"""------------------ 定义Person类 ------------------"""


class Person:
    def __init__(self, name, age):
        self.name = name
        self.age = age

    def say_hello(self):
        print('hello from ', self.name)


"""------------------ 定义Student类继承Person ------------------"""


class Student(Person):
    def __init__(self, name, age, score):
        # 调用父类的初始化方法
        super().__init__(name, age)
        # 定义自己的属性
        self.score = score

    def play_game(self):
        print(f"{self.name}打游戏")

# 创建学生类
stu = Student('小明', 15, 95)
# 访问属性
print("name: {} age: {} height: {}".format(stu.name, stu.age, stu.score))
# 调用方法
stu.say_hello()
